﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using PromotionApp.Model;
using System.Data;
using PromotionApp.DAL;

namespace PromotionApp.BLL
{
    public class StatusBLL
    {
        #region Private Variable

        private static StatusBLL _LanguageBLL = null;

        #endregion 

        #region Constructor

        private StatusBLL()
        {            
        }

        #endregion

        #region Public Method

        public List<Status> GetAllStatus()
        {
            List<Status> list = new List<Status>();
            DataSet ds = StatusDAL.GetInstance().GetAllStatus();

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow r in ds.Tables[0].Rows)
                {
                    Status o = new Status();
                    o.StatusCode = r["StatusCode"].ToString().Trim();
                    o.StatusName = r["StatusName"].ToString().Trim();
                    list.Add(o);
                }
            }
            
            return list;
        }

        public static StatusBLL GetInstance()
        {
            if (_LanguageBLL == null)
                _LanguageBLL = new StatusBLL();

            return _LanguageBLL;
        }


        #endregion
    }
}